﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WUCSearch : System.Web.UI.UserControl
{
    Doctor MyObj = new Doctor();
    DataTable Container = new DataTable();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void SearchBtn_Click(object sender, EventArgs e)
    {
        DataTable Container = new DataTable();
        Doctor MyObj = new Doctor();

        Container = MyObj.ExtractFinalResult(TxtSearch.Text);
        GridView1.DataSource = Container;
        GridView1.DataBind();
       // GridView1.DataSource = MyObj.ExtractFinalResult(TxtSearch.Text);

    
     //   GridView1.DataBind();
       //string value= GridView1.Columns[0].ToString();

        GridView1.SelectedIndex = -1;
        btnPrint.Enabled = false;

        if (GridView1.Visible == true)
        {
            lblmsg2.Text = "To Activate Printer and Extract The Result , Please Select The Row Of The Donor If It Exist , ";
        }
        else
            lblmsg2.Text = "Patient Not Exist !!";
      

    }
    protected void ReleaseBtn_Click(object sender, EventArgs e)
    {
        //Doctor MyObj = new Doctor();
        //GridView1.DataSource = MyObj.ExtractFinalResult(TxtSearch.Text);
        //GridView1.DataBind();
        //HttpCookie FinalResultTable = new HttpCookie();
        //FinalResultTable.Values.Add("MyGrid", GridView1.DataBind());

        Container=MyObj.ExtractFinalResult(TxtSearch.Text);
        Session.Add("MyGrid", Container);
        Response.Redirect("ReleaseFormPage.aspx");
        

    }
    protected void TxtSearch_TextChanged(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        btnPrint.Enabled = true;

    }
}